-
-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
r.null: added test cases the module #5214
base: main
Are you sure you want to change the base?
Conversation
# Create map1: categories 1, 2, 3 as rows | ||
cls.runModule( | ||
"r.mapcalc", | ||
expression="map_basic = if(row() == 1, 1, if(row() == 2, 2, if(row() == 3, 3, null())))", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be simplified:
map_basic = row()
self.assertModule(module) | ||
|
||
# Validate category mappings using r.category | ||
category_output = gs.parse_command("r.describe", map="map_basic", format="json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using "1" flag here to just list all the values seems better
module = SimpleModule("r.null", map="map2", setnull="1", flags="f") | ||
self.assertModule(module) | ||
|
||
category_output = gs.parse_command("r.describe", map="map2", format="json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here the range flag may be better for the floating point
|
||
def test_fill_nulls(self): | ||
"""Verify module fills nulls""" | ||
module = SimpleModule("r.null", map="map_fill_nulls", null="1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not doing much, it would be better if the input had some nulls, no?
This PR introduces tests for the
r.null
module to validate its functionality. The tests cover:Basic Functionality: Verifies that
r.null
correctly adds null values in the raster map usingsetnull
parameter.Float Maps: Tests the
-f
flag for adding null values in the float map.Fill Nulls: Tests
null
parameter to replace null valuesThe tests use temporary regions and custom raster maps.